home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / crypt.diffs < prev    next >
Encoding:
Text File  |  1994-08-02  |  1.3 KB  |  88 lines

  1. 118,$c
  2. void encode (in,out,count)
  3. char *in,*out;
  4. int count;
  5. {
  6.     decode (in,out,count);
  7. }
  8. .
  9. 109,113c
  10.             nr2 = n2;
  11. .
  12. 103c
  13.         *outp++ = i;
  14. .
  15. 95,101c
  16.     while(count -- > 0) {
  17.         i = *inp++;
  18.         nr1 = n1;
  19. .
  20. 93a
  21.     inp = in;
  22.     outp = out;
  23. .
  24. 86,90c
  25.     return (SCMOK);
  26. }
  27.  
  28. void decode (in,out,count)
  29. char *in,*out;
  30. register int count;
  31. {
  32.     register i, n1, n2, nr1, nr2;
  33.     char *inp, *outp;
  34. .
  35. 81,84c
  36.     if (cryptflag == 0) {
  37.         if (cryptsize > 0)  free (cryptbuf);
  38.         cryptsize = 0;
  39.     } else if (x > cryptsize) {
  40.         if (cryptsize > 0)  free (cryptbuf);
  41.         cryptbuf = malloc ((unsigned)x+1);
  42.         if (cryptbuf == NULL)
  43.             return (scmerr (-1,"Can't allocate encryption buffer"));
  44.         cryptsize = x;
  45. .
  46. 78,79c
  47.     static int cryptsize = 0;    /* size of current cryptbuf */
  48. .
  49. 75,76c
  50. int getcryptbuf (x)
  51. int x;
  52. .
  53. 72a
  54.     return (SCMOK);
  55. .
  56. 54d
  57. 42,48c
  58.     cryptflag = 1;
  59.     for (i=0; i<ROTORSZ; i++)  t1[i] = t2[i] = t3[i] = 0;
  60.     (void) strncpy(buf, pw, 8);
  61.     (void) strncpy(buf, crypt(buf, buf), 13);
  62. .
  63. 27,40c
  64.     if (pw == NULL) {
  65.         cryptflag = 0;
  66.         (void) getcryptbuf (0);
  67.         return (SCMOK);
  68. .
  69. 23d
  70. 19c
  71. netcrypt(pw)
  72. .
  73. 12,17c
  74. static char t1[ROTORSZ];
  75. static char t2[ROTORSZ];
  76. static char t3[ROTORSZ];
  77. static char buf[13];
  78. int cryptflag = 0;        /* whether to encrypt/decrypt data */
  79. char *cryptbuf;            /* buffer for data encryption/decryption */
  80. .
  81. 9a
  82. #include "sup.h"
  83.  
  84. extern char *malloc();
  85.  
  86. .
  87. w netcrypt.c
  88.